package com.aspose.cells;

public class MsoFillFormat {
   private FillFormat a;

   MsoFillFormat(FillFormat fillFormat) {
      this.a = fillFormat;
   }

   public Color getForeColor() {
      Color var1 = Color.getWhite();
      if (this.a.getType() == 2) {
         var1 = this.a.getSolidFill().getColor();
      } else if (this.a.getType() == 5) {
         var1 = this.a.getPatternFill().getForegroundColor();
      }

      if (com.aspose.cells.a.c.zh.a(var1)) {
         var1 = Color.getWhite();
      }

      return var1;
   }

   public void setForeColor(Color value) {
      if (this.a.getType() == 2) {
         this.a.getSolidFill().setColor(value);
      } else if (this.a.getType() == 5) {
         this.a.getPatternFill().setForegroundColor(value);
      } else if (this.a.getType() == 0 || this.a.getType() == 1) {
         this.a.setType(2);
         this.a.getSolidFill().setColor(value);
      }

   }

   public double getTransparency() {
      return com.aspose.cells.b.a.zq.b(1.0D - this.a(), 2);
   }

   public void setTransparency(double value) {
      this.a(1.0D - value);
   }

   double a() {
      double var1 = 1.0D;
      if (this.a.getType() == 2) {
         var1 = 1.0D - this.a.getSolidFill().getTransparency();
      } else if (this.a.getType() == 4) {
         var1 = 1.0D - this.a.getTextureFill().getTransparency();
      } else if (this.a.getType() == 5) {
         var1 = 1.0D - this.a.getPatternFill().getForeTransparency();
      }

      return var1;
   }

   void a(double var1) {
      if (this.a.getType() == 2) {
         this.a.getSolidFill().setTransparency(1.0D - var1);
      } else if (this.a.getType() == 4) {
         this.a.getTextureFill().setTransparency(1.0D - var1);
      } else if (this.a.getType() == 5) {
         this.a.getPatternFill().setForeTransparency(1.0D - var1);
      }

   }

   public Color getBackColor() {
      Color var1 = Color.getWhite();
      if (this.a.getType() == 5) {
         var1 = this.a.getPatternFill().getBackgroundColor();
      }

      if (com.aspose.cells.a.c.zh.a(var1)) {
         var1 = Color.getWhite();
      }

      return var1;
   }

   public void setBackColor(Color value) {
      if (this.a.getType() == 5) {
         this.a.getPatternFill().setBackgroundColor(value);
      }

   }

   public byte[] getImageData() {
      switch(this.a.getType()) {
      case 4:
         return this.a.getTextureFill().getImageData();
      default:
         return null;
      }
   }

   public void setImageData(byte[] value) {
      this.a.setType(4);
      this.a.getTextureFill().setImageData(value);
   }

   String b() {
      return this.a.getType() == 4 ? this.a.getTextureFill().a : "";
   }

   void a(String var1) {
      if (this.a.getType() == 4) {
         this.a.getTextureFill().a = var1;
      }

   }

   public void setOneColorGradient(Color color, double degree, int style, int variant) {
      this.a.setType(3);
      this.a.getGradientFill().setOneColorGradient(color, degree, style, variant);
   }

   public int getTexture() {
      int var1 = 24;
      if (this.a.getType() == 4) {
         var1 = this.a.getTextureFill().getType();
      }

      return var1;
   }

   int c() {
      return this.a.getType() == 4 ? this.a.getTextureFill().b : 0;
   }

   void a(int var1) {
      if (this.a.getType() == 4) {
         this.a.getTextureFill().b = var1;
      }

   }

   public boolean isVisible() {
      boolean var1 = true;
      if (this.a.b() != null && this.a.b() instanceof Shape) {
         switch(((Shape)this.a.b()).getMsoDrawingType()) {
         case 0:
         case 8:
            var1 = false;
         }
      }

      switch(this.a.getType()) {
      case 1:
         return false;
      case 2:
      case 3:
      case 4:
      case 5:
         return true;
      case 6:
         if (this.a.b() != null && this.a.b() instanceof Shape) {
            Shape var2 = (Shape)this.a.b();
            if (var2.S()) {
               return var2.getGroup().getFillFormat().isVisible();
            }
         }

         return false;
      default:
         return var1;
      }
   }

   public void setVisible(boolean value) {
      if (value) {
         if (this.a.getType() == 1) {
            this.a.setType(0);
         }
      } else {
         this.a.setType(1);
      }

   }
}
